<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Java实训课程 - 登录</title>
  <!--[if lt IE 9]>
  <script src="libs/html5shiv.min.js"></script>
  <script src="libs/respond.min.js"></script>
  <![endif]-->
  <script src="libs/jquery-1.12.1.min.js"></script>
  <link href="libs/bootstrap-3.3.6/css/bootstrap.min.css" rel="stylesheet">
  <script src="libs/bootstrap-3.3.6/js/bootstrap.min.js"></script>
  <script  src="libs/handlebars.min.js"></script>
  <script  src="libs/d3.v3.min.js"></script>
  <script  src="libs/nv.d3.min.css"></script>
  <script  src="libs/nv.d3.min.js"></script>
</head>
<body>
  <div class="container">
    <div class="row">
      <div class="page-header">
        <h2>存取记账</h2>
      </div>
    </div>
    <div class="row">
      <div class="col-md-8">
        <ul class="nav nav-pills">
          <li role="presentation"><a href="index.html">首页</a></li>
          <li role="presentation"><a href="add1.html">添加收入</a></li>
          <li role="presentation"><a href="add2.html">添加支出</a></li>
          <li role="presentation"><a href="query.html">查询</a></li>
          <li role="presentation" class="active"><a href="statis.html">统计</a></li>
          <li><a href="#">用户:<span id="nick"></span></a></li>
        </ul>
      </div>
      <div class="col-md-4" id="search-box-archive"></div>
    </div>
    <div class="row">
      <div class="col-md-12">
        <hr/>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <hr />
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row">
      <div class="col-md-6">
        <div class="panel panel-primary">
          <div class="panel-heading"><p>当月收入总和</p></div>
          <div class="panel-body"><h1 id="text1" align="center" ></h1></div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="panel panel-primary">
          <div class="panel-heading"><p>当月支出总和</p></div>
          <div class="panel-body"><h1 id="text2" align="center" ></h1></div>
        </div>
      </div>
      <div class="col-md-3">
        <div class="panel panel-warning">
          <div class="panel-heading"><p>每个类别收入总和</p></div>
          <div class="panel-body"><h1 id="text2" align="center" ></h1></div>
        </div>
      </div>
      <div class="col-md-3">
        <div class="panel panel-success">
          <div class="panel-heading"><p>每个类别收入平均</p></div>
          <div class="panel-body"><h1 id="text2" align="center" ></h1></div>
        </div>
      </div>
      <div class="col-md-3">
        <div class="panel panel-warning">
          <div class="panel-heading"><p>每个类别支出总和</p></div>
          <div class="panel-body"><h1 id="text2" align="center" ></h1></div>
        </div>
      </div>
      <div class="col-md-3">
        <div class="panel panel-success">
          <div class="panel-heading"><p>每个类别支出平均</p></div>
          <div class="panel-body"><h1 id="text2" align="center" ></h1></div>
        </div>
      </div>
    </div>
  </div>
  <div class="container">
    <div class="row">
      <div class="col-md-6" id="chart">
        <p class="text-center">
          <br/>
          <hr/>
          <strong>收入统计</strong>
          <svg style="height:480px;width:100%"></svg>
          <br/>
        </p>
      </div>
      <div class="col-md-6" id="chart1">
        <p class="text-center">
          <br/>
          <hr/>
          <strong>支出统计</strong>
          <svg style="height:480px;width:100%"></svg>
          <br/>
        </p>
      </div>
    </div>
  </div>
  <script type="text/javascript">
  $(function(){
  $.getJSON('querys.action',function(res){
	  nv.addGraph(function(){
		  var chart=nv.models.pieChart()
		  .x(function(d){
			  return d.kind
		  }).y(function(d){
			  return d.shou
		  }).showLabels(true).labelType('percent');
		  d3.select("#chart svg")
		  .datum(res)
		  .transition().duration(350)
		  .call(chart);
		  return chart;
	  });
  });
  $.getJSON('querys.action',function(res){
	  nv.addGraph(function(){
		  var chart1=nv.models.pieChart()
		  .x(function(d){
			  return d.kind
		  }).y(function(d){
			  return d.zhi
		  }).showLabels(true).labelType('percent');
		  d3.select("#chart1 svg")
		  .datum(res)
		  .transition().duration(350)
		  .call(chart1);
		  return chart1;
	  });
  });
  });
  </script>
</body>
</html>